<%@ page language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>城市区域 编辑页面</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <jsp:include page="../com/header.jsp"></jsp:include>
    <script type="text/javascript" src="../../js/comm/editcomm.js"></script>
    <script type="text/javascript">
        $(function () {
            getDataById(root + 'cms/sysArea/findSysAreaById', "#sysAreaTmpl", "#sysAreaContent");
            $("#saveOrupdate").click(function () {
                saveData(root + 'cms/sysArea/saveSysArea', 'sysAreaList.jsp');
            });
        });
    </script>
</head>
<body>
<section>
    <div>
        <div class="col-xs-12">
            <div class="box" style="height:900px">
                <div class="box-header">
                    <br>
                    <input type="button" value="确定" id="saveOrupdate" class="btn btn-success"/>
                    <input type="button" value="返回" onclick="backAction('sysAreaList.jsp');" class="btn btn-info"/>
                </div>
                <form id="submit_form" class="form-horizontal">
                    <div class="tab" id="sysAreaContent">
                    </div>
                </form>
            </div>
        </div>
</section>
<script type="text/x-jsrender" id="sysAreaTmpl">
			<fieldset> 
				<input type="hidden" id="tId" name="id" value="{{:id}}" />
				<input type="hidden" id="parentId" name="parentId" value="{{:parentId}}" />
	        	{{!--<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">图片：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
                        	<img id="myImageShow" src="../../{{:imgUrl}}" width="100px" height="100px" />
                        	<input type="hidden" id="imgUrl" name="imgUrl" value="{{:imgUrl}}"/>
                        	<input type="file" id="uploadPhotoFile" name="photoFile" class="upload_file">
                        </div>
					</div>
      			</div>--}}
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">城市名称：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写区域名称" class="form-control input-sm"
						{{if id>0}}
						    data-rule="required;length[0~50]"
						{{else}}
						    data-rule="required;length[0~50];remote[post:../../cms/sysArea/checkArea, areaName]"
						{{/if}}
						 id="areaName" name="areaName" value="{{:areaName}}" />
					</div>
      			</div>
      			<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">是否国内：</label>
       				 <div class="col-md-3">
                             <select class="form-control input-sm" id="areaType" name="areaType" data-rule="required" >
                                  <option  value="">请选择</option>
                                  <option  value="0" {{if !areaType||areaType==0}}selected{{/if}}>国内</option>
                                  <option  value="1" {{if areaType==1}}selected{{/if}}>国外</option>
                             </select>
					</div>
      			</div>
      			<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">是否热点城市：</label>
       				 <div class="col-md-3">
                             <select class="form-control input-sm" id="isHot" name="isHot" data-rule="required" >
                                  <option  value="">请选择</option>
                                  <option  value="1" {{if isHot==true}}selected{{/if}}>热门</option>
                                  <option  value="0" {{if isHot==false}}selected{{/if}}>普通</option>
                             </select>
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">首字母：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写首字母" class="form-control input-sm" data-rule="length[0~50];letters"  maxlength="1"  id="letter" name="letter" value="{{:letter}}" />
					</div>
      			</div>
      			<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">排序id：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写排序id" class="form-control input-sm" data-rule="length[0~50];plusNum" id="orderNum" name="orderNum" value="{{:orderNum}}" />
					</div>
      			</div>
			</fieldset>
			<script type="text/javascript">
                $(function () {
                    $("#areaName").mouseleave(function () {
                        var words = $(this).val();
                        if (words.length <= 0) {
                            return;
                        }
                        $.ajax({
                            url : root + 'cms/sysArea/getLetterFirstChar',
                            type : "POST",
                           data : {
                                word : words
                            },
                            success : function(data) {
                                if (data.code == 1) {
                                    $("#letter").val(data.object);
                                } else  {
                                    myAlert(data.message || '数据加载失败，稍后重试！');
                                }
                            },
                            error:function(){
                                myAlert(data.message || '数据加载失败，稍后重试！');
                            }
                        });
                    });
                });
         </script>
</script>
</body>
</html>